﻿using Hotel.Common;
using Hotel.IServices;
using Hotel.IServices.RequestDTO;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Hotel.Api.Controllers
{
    /// <summary>
    /// 测试
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TestController : ControllerBase
    {
        private readonly IHotelServices _hotelServices;

        public TestController(IHotelServices hotelServices)
        {
            _hotelServices = hotelServices;
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult> InsertDatas(InsertDatasRequestDTO param)
        {
            var result = await _hotelServices.InsertDatas(param);
            return result;
        }

        [HttpPost]
        public async Task<ApiResult> UpdateDatas(UpdateDatasRequestDTO param)
        {
            var result = await _hotelServices.UpdateDatas(param);
            return result;
        }

        [HttpGet]
        public async Task<ApiResult> GetData(int id, string? value)
        {
            var result = await _hotelServices.GetData(id, value);
            return result;
        }

        [HttpGet]
        public async Task<ApiResult> GetDatas([FromQuery]GetDatasRequestDTO param)
        {
            var result = await _hotelServices.GetDatas(param);
            return result;
        }

    }
}
